<!DOCTYPE html>
<html>
<#include "../head.html">
    <body>
    <table class="mc">
        <tr>
            <td class="mc-l">
                <!--左侧导航---{-->
                <div id="navPanelContainer">
                    <div class="system-logo cd"></div>
                    <!--管理员信息---{-->
                    <#include "../adminInfo.html">
                        <!--管理员信息---}-->
                        <div class="nav-wrap">
                            <#include "left.html">
                        </div>
                </div>
                <!--左侧导航---}-->
            </td>
            <td class="mc-m">
                <div class="navToggle"></div>
            </td>
            <td class="mc-r">
                <!--顶部导航---{-->
                <#include "../topNav.html">
                    <!--顶部导航---}-->

                    <!--面包屑导航---{-->
                    <#assign moduleName="修改用户手机号码">
                        <#include "banner.html">
                            <!--面包屑导航---}-->

                            <!--工具栏--{-->
                            <div id="toolbar" class="clearfix">
                              
                            </div>
                            <!--工具栏--}-->

                            <div id="main" class="clearfix">
                                    <div class="valBox w750 h300">
                                        <div class="top">
                                            <strong>查看用户</strong>
                                        </div>
                                        <form method="post" action="/admin/operate/modifyPhoneStepTwo.html" id="userform2">
	                                        <div class="val clearfix">
	                                            <ul>
	                                            	<li>
	                                                    <div class="title" style="width: 150px;">原手机号码：</div>
	                                                    <div class="v">
	                                                    	<input id="oldPhone" name="oldPhone" type="text"  style="width:150px;" value="<#if user??>${user.phone}</#if>" readonly="readonly"></input>
	                                                    </div>
	                                                </li>
	                                                
	                                               <li>
	                                                    <div class="title" style="width: 150px;">新手机号码：</div>
	                                                    <div class="v">
	                                                    	<input id="newPhone" name="newPhone" type="text"  style="width:150px;"></input>
	                                                    </div>
	                                                </li>
	                                                
	                                               	 <li>
	                                                    <div class="title" style="width: 150px;">验证码：</div>
	                                                    <div class="v">
	                                                    	<input id="validCode" name="validCode" type="text"  style="width:150px;"></input>
	                                                    	<input type="button" id="verify_btn" style="display:inline-block;min-width:120px;height:25px;color:#777;line-height:25px;cursor:pointer;text-align:center;" title="获取短信验证码" value="获取验证码">
	                                                    </div>
	                                                </li>
	                                                
	                                            </ul>
	                                            <div class="other">
	                                                <input type="button" id="search" value="确认" class="input-button confirm"/>
	                                            </div>
	                                        </div>
	                                        <input type="hidden" name="userId" value="<#if user??>${user.userId?c}</#if>">
	                                        <input type="hidden" name="actionType" value="modify">
                                        </form>
                                    </div>

                            </div>
            </td>
        </tr>
        <tr>
            <!--尾部--{-->
            <td colspan="3" class="mc-b"><#include "../foot.html"></td>
            <!--尾部--}-->
        </tr>
    </table>
    </body>
</html>
<script src="${webroot}${theme_dir}/script/jquery.qian360.js"></script>
		<script>
		
	    function getMobileCode(){
	     	$.ajax({
	             url:"/admin/operate/modifyPhoneCode.html",
	             type:"post",
	             data:"phone="+$("#newPhone").val(),
	             dataType:"json",
	             async:false,
	             success:function(data){
	                 
	             },
	             timeout:50000,
	             error:function(){
	                 alert("请求超时");
	             }
	         });
	     }
	    
		 var COOKIE_VERIFY = 'modifyPhone'; 
		    //判断cookie是否存在
		    if ($.cookie(COOKIE_VERIFY)) { //刷新后还可以正确显示倒计时
		        time();
		    } 
		    //秒倒计时
		    function time() {
		        var tmpWait = $.cookie(COOKIE_VERIFY);
		        if ($.cookie(COOKIE_VERIFY)) {
		            $("#verify_btn").attr("disabled", true);
		            $("#verify_btn").val(tmpWait + "秒后重新获取");
		            --tmpWait;
		            $.cookie(COOKIE_VERIFY, tmpWait, {
		                path: '/',
		                expires: 10
		            });
		            if (tmpWait == 0) {
		                $.cookie(COOKIE_VERIFY, null, {
		                    path: '/'
		                }); //删除cookie  
		            }
		            setTimeout(function() {
		                    time();
		                },
		                1000)
		        } else {
		            $("#verify_btn").removeAttr("disabled");
		            $("#verify_btn").val("获取手机验证码");
		        }
		    } 
		     //发送手机验证码
		     $("#verify_btn").click(function(){
		    	 	if($("#newPhone").val()==''){
		    	 		alert("请先输入新手机号码！");
		    	 	}else{
		    	 		getMobileCode(); //获取验证码
			            $.cookie(COOKIE_VERIFY,30, {
			                path: '/',
			                expires: 30
			            });
			            time();
		    	 	}
		         
		     });
				
		     
				$("#search").click(function(){
					if($("#newPhone").val()==''||$("#validCode").val()==''){
						alert('手机号码和验证码不能为空！');
					}else{
						$("#userform2").submit();
					}
				});
		</script>
<#include "../jsPage.html">
